package org.pvt.model;

import org.jetbrains.annotations.NotNull;

import java.util.HashSet;
import java.util.Set;

import static org.pvt.model.Models.Expense;
import static org.pvt.model.Models.Person;

/**
 * @author Pavel Talanov
 */
public final class Payment extends Model {
    @SuppressWarnings("FieldCanBeLocal")
    @NotNull
    private static String TABLE_NAME = "payment";
    @NotNull
    public static String AMOUNT = "amount";

    @NotNull
    @Override
    public String getTableName() {
        return TABLE_NAME;
    }

    @NotNull
    @Override
    protected Set<Model.Field> getFields() {
        Set<Model.Field> fields = new HashSet<Model.Field>(super.getFields());
        fields.add(new Field(Expense, Behaviour.CASCADE));
        fields.add(new Field(AMOUNT, "REAL"));
        fields.add(new Field(Person, Behaviour.RESTRICT));
        return fields;
    }
}
